<%@page import="crm.control.ScheduleControl"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="crm.model.Schedule"%>
<%@page import="crm.model.Employees"%>
<%@page import="crm.util.DateTime" %>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>添加日程</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body >
  	<%
  		request.setCharacterEncoding("UTF-8");
  		Employees employees = (Employees) session.getAttribute("user");
  		Schedule schedule = new Schedule();
  		schedule.setCreater(employees.getId());
  		schedule.setCreate_time(DateTime.DateTime());
  		schedule.setContent(ParamUtil.getString(request, "content","null"));
  		schedule.setRelated_customer(ParamUtil.getString(request, "customer"));
  		// System.out.println(ParamUtil.getString(request, "customer"));
  		// schedule.setRelated_receipt(ParamUtil.getString(request, "related_receipt"));
  		schedule.setTheme(ParamUtil.getString(request, "theme"));
  		schedule.setFinish_time("未完成");
  		schedule.setState("未完成");
  		if(ScheduleControl.addSchedule(schedule)){
  	 %>
  	 <script type="text/javascript">
  	 	alert("添加成功！");
  	 	window.top.location.href="schedule.jsp"
  	 </script>
  	 <%}else{%>
  	 	<script type="text/javascript">
  	 		alert("添加失败！");
  	 		window.top.location.href="schedule.jsp"
  	 	</script>
  	 <%} %>
  </body>
</html>
